package leetcode;

/**
 * @Description 461. 汉明距离
 * @Author away
 * @Version V1.0.0
 * @Since 1.0
 * @Date 21.5.27
 */

public class T461 {

    public static void main(String[] args) {
        T461 t461 = new T461();
        int i = t461.hammingDistance(1, 4);
        System.out.println(i);
    }
    int hammingDistance(int x, int y) {
        int t = x ^ y;
        Integer i = new Integer(t);
        return Integer.toString(t, 2).replace("0","").length();
    }
}
